using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ApplicationBlocks.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DataHelper.DAL
{
    public class BK_Order
    {
private static  string m_trConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

       #region BK_OrderSelectAll
        public static SqlDataReader BK_OrderSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "BK_OrderSelectAllRows",strSearch,top,bottom);
            return SqlHelper.ExecuteReader(m_trConnectionString, "BK_OrderSelectAllRows",strSearch,top,bottom);
        }
        #endregion
       #region BK_OrderSelectRow
        public static SqlDataReader BK_OrderSelectRow(int ID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "BK_OrderSelectRow", ID);
            return SqlHelper.ExecuteReader(m_trConnectionString, "BK_OrderSelectRow", ID);
        }
        #endregion
       #region BK_OrderInsertRow
        public static void BK_OrderInsertRow(int ID, string Name, string Phone, string Note, DateTime CreatedDate, bool IsDeleted, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "BK_OrderInsertRow", ID, Name, Phone, Note, CreatedDate, IsDeleted);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "BK_OrderInsertRow", ID, Name, Phone, Note, CreatedDate, IsDeleted);
        }
        #endregion
       #region BK_OrderUpdateRow
        public static void BK_OrderUpdateRow(int ID, string Name, string Phone, string Note, DateTime CreatedDate, bool IsDeleted, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "BK_OrderUpdateRow", ID, Name, Phone, Note, CreatedDate, IsDeleted);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "BK_OrderUpdateRow", ID, Name, Phone, Note, CreatedDate, IsDeleted);
        }
        #endregion
       #region BK_OrderDeleteRow
        public static void BK_OrderDeleteRow(int ID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "BK_OrderDeleteRow", ID);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "BK_OrderDeleteRow", ID);
        }
        #endregion

    }
}

